package com.atguigu.juc.interview.cas;

import java.util.concurrent.atomic.AtomicReference;

/**
 * @author leimingchao
 * @create 2021-04-21 21:26
 */
public class AtomicReferenceTest {
    public static void main(String[] args) {
        AtomicReference<String> atomicReference=new AtomicReference<>();
        atomicReference.set("z3");
        System.out.println(atomicReference.compareAndSet("z3", "lisi")+"\t 当前值为："+atomicReference.get());
        System.out.println(atomicReference.compareAndSet("z3", "lisi")+"\t 当前值为："+atomicReference.get());
    }
}
